package com.mt.api.modules.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mt.api.modules.domain.RoleMenu;
import com.mt.api.modules.manager.IRoleMenuManager;
import com.mt.api.modules.mapper.RoleMenuMapper;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: plover
 * @Date: 2022-04-30
 * @Description:
 */
@Component
public class RoleMenuManagerImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements IRoleMenuManager {


    @Override
    public List<RoleMenu> getByRoleId(Integer roleId) {
        LambdaQueryWrapper<RoleMenu> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(RoleMenu::getRoleId, roleId);
        return baseMapper.selectList(wrapper);
    }

    @Override
    public List<RoleMenu> getByRoleIds(List<Integer> roleIds) {
        LambdaQueryWrapper<RoleMenu> wrapper = Wrappers.lambdaQuery();
        wrapper.in(RoleMenu::getRoleId, roleIds);
        return baseMapper.selectList(wrapper);
    }
}
